<?php
namespace app\erp_meixingtiyu\validate;

use think\Validate;

class Arena extends Validate
{
    protected $rule = [
        'name' => 'require',
        'time_template_id' => 'require|number',
        'maximum|最多限制' => 'require|minimum',
        'minimum|最少限制' => 'require|minimum',
        'status' => 'require|number',
        'sort' => 'require|number',
    ];

    protected function minimum($value, $rule, $data)
    {
        if($data['minimum'] < $data['maximum'] && $data['maximum'] != 0) {
            return '最少限制必须小于等于最大限制';
        }

        return true;
    }
}
